<!DOCTYPE HTML>
<html lang>
<head><meta name="generator" content="Hexo 3.9.0">
    <!--Setting-->
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1">
    <meta http-equiv="Cache-Control" content="no-siteapp">
    <meta http-equiv="Cache-Control" content="no-transform">
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta name="apple-mobile-web-app-capable" content="腾宇的个人博客">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="format-detection" content="telephone=no,email=no,adress=no">
    <meta name="browsermode" content="application">
    <meta name="screen-orientation" content="portrait">
    <meta name="theme-version" content="1.2.3">
    <meta name="root" content="/blog/">
    <link rel="dns-prefetch" href="https://gitee.com/bingtengaoyu/blog">
    <!--SEO-->

    <meta name="keywords" content>


    <meta name="description" content="数组的 api 归纳总结@(作者)[腾宇]
###1. 小工具Array.length

除了直接拿来用，还可以判断数组是否为空，也可以直接截短数组 (不常用)。

12[1, 2, 3, 4,...">



<meta name="robots" content="all">
<meta name="google" content="all">
<meta name="googlebot" content="all">
<meta name="verify" content="all">

    <!--Title-->


<title>数组的 api 归纳总结 | 腾宇的个人博客</title>


    <link rel="alternate" href="/atom.xml" title="腾宇的个人博客" type="application/atom+xml">


    <link rel="icon" href="/favicon.ico">

    



<link rel="stylesheet" href="/blog/css/bootstrap.min.css?rev=3.3.7">
<link rel="stylesheet" href="/blog/css/font-awesome.min.css?rev=4.5.0">
<link rel="stylesheet" href="/blog/css/style.css?rev=@@hash">




    
	<div class="hide">
		<script type="text/javascript">
			var cnzz_protocol = (("https:" == document.location.protocol) ? " https://" : " http://");document.write(unescape("%3Cspan class='cnzz_stat_icon_1263868967 hide' %3E%3Cscript%20src%3D%22https%3A%2F%2Fs95.cnzz.com%2Fz_stat.php%3Fweb_id%3D1272564536%22%3E%3C%2Fscript%3E%3C/span%3E%3Cscript src='" + cnzz_protocol + "s19.cnzz.com/z_stat.php%3Fid%3D1263868967%26show%3Dpic1' type='text/javascript'%3E%3C/script%3E"));
		</script>
	</div>






    

</head>

</html>
<!--[if lte IE 8]>
<style>
    html{ font-size: 1em }
</style>
<![endif]-->
<!--[if lte IE 9]>
<div style="ie">你使用的浏览器版本过低，为了你更好的阅读体验，请更新浏览器的版本或者使用其他现代浏览器，比如Chrome、Firefox、Safari等。</div>
<![endif]-->

<body>
    <header class="main-header"  style="background-image:url(http://snippet.shenliyang.com/img/banner.jpg)"  >
    <div class="main-header-box">
        <a class="header-avatar" href="/" title='耿兵兵'>
            <img src="/blog/img/avatar.jpg" alt="logo头像" class="img-responsive center-block">
        </a>
        <div class="branding">
        	<!--<h2 class="text-hide">Snippet主题,从未如此简单有趣</h2>-->
            
                 <img src="/blog/img/branding.png" alt="Snippet 博客主题" class="img-responsive center-block">
            
    	</div>
    </div>
</header>
    <nav class="main-navigation">
    <div class="container">
        <div class="row">
            <div class="col-sm-12">
                <div class="navbar-header"><span class="nav-toggle-button collapsed pull-right" data-toggle="collapse" data-target="#main-menu" id="mnav">
                    <span class="sr-only"></span>
                        <i class="fa fa-bars"></i>
                    </span>
                    <a class="navbar-brand" href="https://gitee.com/bingtengaoyu/blog">腾宇的个人博客</a>
                </div>
                <div class="collapse navbar-collapse" id="main-menu">
                    <ul class="menu">
                        
                            <li role="presentation" class="text-center">
                                <a href="/blog"><i class="fa "></i>Home</a>
                            </li>
                        
                            <li role="presentation" class="text-center">
                                <a href="https://bingtengaoyu.gitee.io/vuetools/#/"><i class="fa "></i>vue插件</a>
                            </li>
                        
                            <li role="presentation" class="text-center">
                                <a href="https://bingtengaoyu.gitee.io/reactantd/#/"><i class="fa "></i>reactAnt模板</a>
                            </li>
                        
                            <li role="presentation" class="text-center">
                                <a href="https://bingtengaoyu.gitee.io/home/"><i class="fa "></i>简介</a>
                            </li>
                        
                            <li role="presentation" class="text-center">
                                <a href="http://gank.io/"><i class="fa "></i>工具</a>
                            </li>
                        
                            <li role="presentation" class="text-center">
                                <a href="/blog/archives/"><i class="fa "></i>时间轴</a>
                            </li>
                        
                    </ul>
                </div>
            </div>
        </div>
    </div>
</nav>
    <section class="content-wrap">
        <div class="container">
            <div class="row">
                <main class="col-md-8 main-content m-post">
                    <p id="process"></p>
<article class="post">
    <div class="post-head">
        <h1 id="数组的 api 归纳总结">
            
	            数组的 api 归纳总结
            
        </h1>
        <div class="post-meta">
    
        <span class="categories-meta fa-wrap">
            <i class="fa fa-folder-open-o"></i>
            
        </span>
    

    
        <span class="fa-wrap">
            <i class="fa fa-tags"></i>
            <span class="tags-meta">
                
            </span>
        </span>
    

    
        
        <span class="fa-wrap">
            <i class="fa fa-clock-o"></i>
            <span class="date-meta">2019/07/14</span>
        </span>
        
    
</div>
            
            
    </div>
    
    <div class="post-body post-content">
        <h1 id="数组的-api-归纳总结"><a href="#数组的-api-归纳总结" class="headerlink" title="数组的 api 归纳总结"></a>数组的 api 归纳总结</h1><p>@(作者)[腾宇]</p>
<p>###1. 小工具<br><strong>Array.length</strong></p>
<ul>
<li><strong>除了直接拿来用，还可以判断数组是否为空，也可以直接截短数组 (不常用)。</strong></li>
</ul>
<figure class="highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">[<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>, <span class="number">4</span>, <span class="number">5</span>].length = <span class="number">2</span>   </span><br><span class="line"><span class="comment">// [1, 2]</span></span><br></pre></td></tr></table></figure>

<p>*<em>Array.isArray *</em></p>
<ul>
<li><strong>使用此方法适合用于判断数组类型，返回的是布尔值。</strong></li>
</ul>
<p>*<em>Array.from *</em></p>
<ul>
<li><strong>类数组对象转数组，像 DOM 的一些集合，arguments，还有 Set/Map/String 等具有遍历器接口的数据结构都可以转换。</strong></li>
</ul>
<figure class="highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">let</span> a = &#123;</span><br><span class="line">   <span class="string">'0'</span>: <span class="string">'a'</span>,</span><br><span class="line">   <span class="string">'1'</span>: <span class="string">'b'</span>,</span><br><span class="line">   <span class="string">'2'</span>: <span class="string">'c'</span>,</span><br><span class="line">    length: <span class="number">3</span></span><br><span class="line"> &#125;</span><br><span class="line"><span class="keyword">let</span> b = <span class="built_in">Array</span>.from(a)   </span><br><span class="line"><span class="comment">// ['a', 'b', 'c']</span></span><br></pre></td></tr></table></figure>

<p>*<em>Array.of *</em></p>
<ul>
<li><strong>用于将一组值转换为数组。Array.of () 基本上可以用来替代 Array () 或 new Array () ，并且不存在由于参数不同而导致的重载，它的行为非常统一。Array.of () 总是返回参数值组成的数组。如果没有参数，就返回一个空数组。</strong></li>
</ul>
<figure class="highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line"><span class="built_in">Array</span>.of(<span class="number">3</span>, <span class="number">11</span>, <span class="number">8</span>)      </span><br><span class="line"><span class="comment">// [3,11,8]</span></span><br><span class="line"><span class="built_in">Array</span>.of(<span class="number">3</span>)        </span><br><span class="line"><span class="comment">// [3]</span></span><br><span class="line"><span class="built_in">Array</span>.of()          </span><br><span class="line"><span class="comment">// []</span></span><br></pre></td></tr></table></figure>

<p><strong>fill</strong><br>-<strong>填充一个数组，用于空数组的初始化非常方便。数组中已有的元素，会被全部抹去。该方法还可以接受第二个和第三个参数，用于指定填充的起始位置和结束位置。(含头不含尾)</strong></p>
<figure class="highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">[<span class="string">'a'</span>, <span class="string">'b'</span>, <span class="string">'c'</span>].fill(<span class="number">7</span>, <span class="number">1</span>, <span class="number">2</span>)  </span><br><span class="line"><span class="comment">//['a', 7, 'c']</span></span><br></pre></td></tr></table></figure>

<p>###2. 增删改查<br><strong>pop</strong> </p>
<ul>
<li><strong>删除并返回数组的最后一个元素。如果数组为空，则返回 undefined。</strong></li>
</ul>
<p><strong>push</strong></p>
<ul>
<li><strong>向数组的末尾添加一个或多个元素，并返回新的长度。</strong></li>
</ul>
<p><strong>shift</strong></p>
<ul>
<li><strong>把数组的第一个元素从其中删除，并返回第一个元素的值。</strong></li>
</ul>
<p><strong>unshift</strong></p>
<ul>
<li><strong>向数组的开头添加一个或更多元素，并返回新的长度。</strong></li>
</ul>
<p><strong>find</strong></p>
<ul>
<li><strong>用于找出第一个符合条件的数组成员。它的参数是一个回调函数，所有数组成员依次执行该回调函数，直到找出第一个返回值为 true 的成员，然后返回该成员。如果没有符合条件的成员，则返回 undefined。</strong><figure class="highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">[<span class="number">1</span>, <span class="number">5</span>, <span class="number">10</span>, <span class="number">15</span>].find(<span class="function">(<span class="params">value, index, arr</span>) =&gt;</span> &#123;</span><br><span class="line">   <span class="keyword">return</span> value &gt; <span class="number">9</span></span><br><span class="line">&#125;)</span><br></pre></td></tr></table></figure>

</li>
</ul>
<p><strong>findIndex</strong></p>
<ul>
<li><strong>数组实例的 findIndex 方法的用法与 find 方法非常类似，返回第一个符合条件的数组成员的位置，如果所有成员都不符合条件，则返回 - 1。</strong><figure class="highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">[<span class="number">1</span>, <span class="number">5</span>, <span class="number">10</span>, <span class="number">15</span>].findIndex(<span class="function">(<span class="params">value, index, arr</span>) =&gt;</span> &#123;</span><br><span class="line">   <span class="keyword">return</span> value &gt; <span class="number">9</span></span><br><span class="line">&#125;)</span><br><span class="line"> <span class="comment">// 2</span></span><br></pre></td></tr></table></figure>

</li>
</ul>
<p><strong>indexOf /lastIndexOf</strong></p>
<ul>
<li><strong>返回某个指定的字符串值在字符串中首次 / 最后一次出现的位置，对大小写敏感。如果要检索的字符串值没有出现，则该方法返回 -1</strong></li>
</ul>
<figure class="highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="string">"Hello world!"</span>.indexOf(<span class="string">"Hello"</span>)  </span><br><span class="line"><span class="comment">// 0</span></span><br></pre></td></tr></table></figure>

<p><strong>includes</strong></p>
<ul>
<li><strong>返回一个布尔值，表示某个数组是否包含给定的值</strong></li>
</ul>
<figure class="highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">[<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>].includes(<span class="number">2</span>)     </span><br><span class="line"><span class="comment">// true</span></span><br></pre></td></tr></table></figure>

<p><strong>slice(start, end)</strong></p>
<ul>
<li><strong>返回一个新的数组，包含从 start 到 end （不包括）</strong></li>
<li><strong>start: 必需。</strong></li>
<li><strong>end: 可选。负数表示从末位开始算</strong></li>
</ul>
<p><strong>splice(index, num, item1,…, itemx)</strong></p>
<ul>
<li><strong>用于添加或删除数组中的元素。会改变原始数组。</strong></li>
<li><strong>index: 必需。规定从何处添加 / 删除元素。</strong></li>
<li><strong>num: 要删除的数量，</strong></li>
<li><strong>item1, …, itemx 是可选参数，表示要添加到数组的新元素</strong></li>
</ul>
<p><strong>concat</strong></p>
<ul>
<li><strong>用于连接两个或多个数组</strong></li>
</ul>
<p><strong>join</strong></p>
<ul>
<li><strong>返回一个通过指定的分隔符进行分隔的一个字符串</strong></li>
</ul>
<p>*<em>copyWithin(target, start, end) *</em></p>
<ul>
<li><strong>在当前数组内部，将指定位置的成员复制到其他位置（会覆盖原有成员），然后返回当前数组。(ps: 此方法目前我还没用到过)</strong></li>
<li><strong>target（必需）：从该位置开始替换数据。如果为负值，表示倒数。</strong></li>
<li><strong>start（可选）：从该位置开始读取数据，默认为 0。如果为负值，表示从末尾开始计算。</strong></li>
<li>*<em>end（可选）：到该位置前停止读取数据，默认等于数组长度。如果为负值，表示从末尾开始计算。 *</em><figure class="highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">[<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>, <span class="number">4</span>, <span class="number">5</span>].copyWithin(<span class="number">0</span>, <span class="number">3</span>)     </span><br><span class="line"><span class="comment">// [4, 5, 3, 4, 5]</span></span><br></pre></td></tr></table></figure>

</li>
</ul>
<p>###3. 迭代相关方法<br><strong>forEach</strong></p>
<ul>
<li><strong>让数组的每一项都执行给定的函数。因为返回值是 undefined，所以不能链式调用。使用 break，return 语句不能使其中止或者跳出 forEach 循环，除非抛出异常。(ps: 本人用的很少 ，一般会选择其他迭代 api 或者普通的 for 循环就很好)</strong></li>
</ul>
<p><strong>for…in</strong></p>
<ul>
<li><strong>可以用于对数组或者对象的属性进行循环操作。</strong></li>
</ul>
<p><strong>注意：for..in 遍历对象的时候，会把其原型 (prototype) 中方法与属性给遍历出来，可以在循环里使用对象的 hasOwnProperty() 方法去判断，来避免这个问题。或者直接选用 Object 的 API：keys/enenties/values 去遍历对象</strong></p>
<p><strong>for…of</strong></p>
<ul>
<li><strong>for…of 允许你遍历 DOM 集合，Array（数组）, String（字符串）, Map（映射）, Set（集合）等可迭代的数据结构等。</strong></li>
</ul>
<p><strong>keys/enenties/values</strong></p>
<ul>
<li><strong>ES6 提供的三个新方法 ——entries()、keys()和values()—— 用于遍历数组。它们都返回一个遍历器对象，可以用 for…of 循环进行遍历，唯一的区别是 keys() 是对键名的遍历、values() 是对键值的遍历，entries() 是对键值对的遍历。</strong></li>
</ul>
<p><strong>every</strong></p>
<ul>
<li><strong>对数组中每一项运行给定函数，如果该函数的每一项都符合条件，则返回 true。</strong></li>
</ul>
<p><strong>some</strong></p>
<ul>
<li><strong>对数组中每一项运行给定函数，如果该函数有一项符合条件，则返回 true。</strong></li>
</ul>
<p><strong>filter</strong></p>
<ul>
<li><strong>每个数组项调用给定函数，条件为 true 的将返到一个新数组中</strong></li>
</ul>
<p><strong>map</strong></p>
<ul>
<li><strong>每个数组项调用给定函数，返回每次函数调用的结果组成一个新数组。</strong></li>
</ul>
<p><strong>sort</strong></p>
<ul>
<li><strong>主要用于对数组的元素进行排序。如果没有传参将按字母顺序（字符编码顺序）对数组中的元素进行排序，如果想按照其他标准进行排序，就需要进行传一个回调函数，该函数要比较两个值用于排序</strong></li>
</ul>
<p><strong>reverse</strong></p>
<ul>
<li><strong>用于颠倒数组中元素的顺序。该方法会改变原来的数组，而不会创建新的数组。</strong></li>
</ul>
<p><strong>flat</strong></p>
<ul>
<li><strong>用来 ‘ 拉平 ‘ 数组。默认只会 “拉平” 一层，如果想要 “拉平” 多层的嵌套数组，参数可以传数字，表示想要拉平的层数。传 Infinity 参数，表示不管有多少层嵌套，都要转成一维数组</strong></li>
</ul>
<p><strong>flatMap</strong></p>
<ul>
<li><strong>参数是一个遍历函数，对原数组的每个成员执行 map，然后对返回值组成的数组执行 flat() 方法。该方法返回一个新数组，不改变原数组。通俗说，就是先 map, 再拉平一层</strong></li>
</ul>
<p><strong>reduce</strong></p>
<ul>
<li>*<em>此方法接收两个参数：一个是回调函数，一个是初始值。 *</em></li>
<li><strong>回调常用的参数只有两个：prev 和 cur。接下来我们跟着实例来看看具体用法吧～利用 reduce 来计算一个字符串中每个字母出现次数。</strong><figure class="highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">const</span> str = <span class="string">'jshdjsihh'</span>;</span><br><span class="line"><span class="keyword">const</span> obj = str.split(<span class="string">''</span>).reduce(<span class="function">(<span class="params">pre, cur</span>) =&gt;</span> &#123;</span><br><span class="line">   pre[cur] ? pre[cur]++ : pre[cur] = <span class="number">1</span></span><br><span class="line">   <span class="keyword">return</span> pre</span><br><span class="line">&#125;, &#123;&#125;)</span><br><span class="line"><span class="built_in">console</span>.log(obj)     <span class="comment">// &#123;j: 2, s: 2, h: 3, d: 1, i: 1&#125;</span></span><br></pre></td></tr></table></figure>

</li>
</ul>
<p>###4. 数组 api 对于空位的处理</p>
<ul>
<li><p><strong>数组的空位指，数组的某一个位置没有任何值。比如，[,,,1,2,3]</strong></p>
</li>
<li><p><strong>ES6 是明确将空位转为 undefined, 由于空位的处理规则非常不统一，所以建议避免出现空位。</strong></p>
</li>
<li><p><strong>foreach(), filter(), reduce(), every() 和 some() 都会跳过空位。</strong></p>
</li>
<li><p><strong>map() 不会遍历空位，直接跳过，但会保留这个空位。</strong></p>
<figure class="highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">let</span> a = [<span class="number">1</span>, , , <span class="number">2</span>]</span><br><span class="line"><span class="keyword">let</span> b = a.map(<span class="function"><span class="params">item</span> =&gt;</span> ++item)   </span><br><span class="line"><span class="comment">// [2, empty × 2, 3]</span></span><br></pre></td></tr></table></figure>
</li>
<li><p><strong>for…of 循环会遍历空位，直接将空位转为 undefined。</strong></p>
<figure class="highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">let</span> a = [<span class="number">1</span>, , , <span class="number">2</span>]</span><br><span class="line"><span class="keyword">for</span> (<span class="keyword">let</span> i <span class="keyword">of</span> a) &#123;</span><br><span class="line">    <span class="built_in">console</span>.log(i)</span><br><span class="line">&#125;</span><br><span class="line"><span class="comment">// 1, undefined, undefined, 2</span></span><br></pre></td></tr></table></figure>
</li>
<li><p><strong>for…in 循环不会遍历空位，直接跳过。</strong></p>
<figure class="highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">var</span> a=[,,,<span class="number">2</span>,<span class="number">3</span>,]</span><br><span class="line"><span class="keyword">for</span>(<span class="keyword">let</span> i <span class="keyword">in</span> a)&#123;</span><br><span class="line">   <span class="built_in">console</span>.log(i)</span><br><span class="line">&#125;                   <span class="comment">// 3, 4</span></span><br></pre></td></tr></table></figure>
</li>
<li><p><strong>fill() 会将空位视为正常的数组位置，一样填充覆盖。</strong></p>
<figure class="highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">[, , ,].fill(<span class="number">7</span>)    <span class="comment">//[7, 7, 7]</span></span><br></pre></td></tr></table></figure>
</li>
<li><p><strong>join() 会将空位视为 undefined，而 undefined 和 null 会被处理成空字符串。</strong></p>
<figure class="highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">[<span class="number">1</span>,,<span class="number">2</span>].join(<span class="string">'-'</span>)        <span class="comment">// "1--2"</span></span><br></pre></td></tr></table></figure>
</li>
<li><p><strong>Array.from 方法会将数组的空位，转为 undefined。</strong></p>
</li>
<li><p><strong>Array.from([,,1])    //  [undefined, undefined, 1]</strong></p>
</li>
<li><p><strong>扩展运算符（…）也会将空位转为 undefined。</strong></p>
<figure class="highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="built_in">console</span>.log(...[,,<span class="number">1</span>])        <span class="comment">// undefined undefined 1</span></span><br><span class="line">copyWithin() 会连空位一起拷贝。</span><br></pre></td></tr></table></figure>
</li>
<li><p><strong>entries()、keys()、values()、find() 和 findIndex() 会将空位处理成 undefined。</strong></p>
</li>
</ul>

    </div>
    
    <div class="post-footer">
        <div>
            
                转载声明：商业转载请联系作者获得授权,非商业转载请注明出处 © <a href="" target="_blank">Snippet</a>
            
        </div>
        <div>
            
        </div>
    </div>
</article>

<div class="article-nav prev-next-wrap clearfix">
    
        <a href="/blog/2019/07/14/console.log()的用法/" class="pre-post btn btn-default" title='console的用法'>
            <i class="fa fa-angle-left fa-fw"></i><span class="hidden-lg">上一篇</span>
            <span class="hidden-xs">console的用法</span>
        </a>
    
    
        <a href="/blog/2019/07/14/四种遍历数组的方法/" class="next-post btn btn-default" title='四种遍历数组的方法'>
            <span class="hidden-lg">下一篇</span>
            <span class="hidden-xs">四种遍历数组的方法</span><i class="fa fa-angle-right fa-fw"></i>
        </a>
    
</div>


    <div id="comments">
        
	
    <div id="vcomments" class="valine"></div>
    <script src="//cdn1.lncld.net/static/js/3.0.4/av-min.js"></script>
<script src="/blog/assets/valine.min.js"></script>

    <script>
        new Valine({
            av: AV,
            el: '#vcomments',
            appId: 'xOKV9J4UeQAtVkvnJC7Kq2Jn-gzGzoHsz',
            appKey: 'erIpQac4azoCmgfBB7Dl9maa',
            placeholder: '说点什么吧',
            notify: false,
            verify: true,
            avatar: 'mm',
            meta: 'nick,mail'.split(','),
            pageSize: '10',
            path: window.location.pathname,
            lang: ''.toLowerCase()
        })
    </script>


    </div>





                </main>
                
                    <aside id="article-toc" role="navigation" class="col-md-4">
    <div class="widget">
        <h3 class="title">Table of Contents</h3>
        
            <ol class="toc"><li class="toc-item toc-level-1"><a class="toc-link" href="#数组的-api-归纳总结"><span class="toc-text">数组的 api 归纳总结</span></a></li></ol>
        
    </div>
</aside>

                
            </div>
        </div>
    </section>
    <footer class="main-footer">
    <div class="container">
        <div class="row">
        </div>
    </div>
</footer>

<a id="back-to-top" class="icon-btn hide">
	<i class="fa fa-chevron-up"></i>
</a>




    <div class="copyright">
    <div class="container">
        <div class="row">
            <div class="col-sm-12">
                <div class="busuanzi">
    
</div>

            </div>
            <div class="col-sm-12">
                <span>Copyright &copy; 2017
                </span> |
                <span>
                    Powered by <a href="//hexo.io" class="copyright-links" target="_blank" rel="nofollow">Hexo</a>
                </span> |
                <span>
                    Theme by <a href="//github.com/shenliyang/hexo-theme-snippet.git" class="copyright-links" target="_blank" rel="nofollow">Snippet</a>
                </span>
            </div>
        </div>
    </div>
</div>







<script src="/blog/js/app.js?rev=@@hash"></script>

</body>
</html>